using System;
using System.Text;

namespace RealState.BusinessObjects
{
	[Serializable()]
	public class Categories
	{
        private int _RowNum;

        public int RowNum
        {
            get { return _RowNum; }
            set { _RowNum = value; }
        }

		private int _Id;

		public int Id
		{
			get { return _Id; }
			set { _Id = value; }
		}

        private string _Code;

        public string Code
        {
            get { return _Code; }
            set { _Code = value; }
        }

		private string _Title;

		public string Title
		{
			get { return _Title; }
			set { _Title = value; }
		}

		private int _ParentId;

		public int ParentId
		{
			get { return _ParentId; }
			set { _ParentId = value; }
		}

		private bool _IsActive;

		public bool IsActive
		{
			get { return _IsActive; }
			set { _IsActive = value; }
		}

		private bool _IsRemove;

		public bool IsRemove
		{
			get { return _IsRemove; }
			set { _IsRemove = value; }
		}

		private int _CategoryType;

		public int CategoryType
		{
			get { return _CategoryType; }
			set { _CategoryType = value; }
		}

        private int _Deep;

        public int Deep
        {
            get { return _Deep; }
            set { _Deep = value; }
        }


		private int _Position;

		public int Position
		{
			get { return _Position; }
			set { _Position = value; }
		}

		public Categories()
		{ }

		public Categories(int Id,string Title,int ParentId,bool IsActive,bool IsRemove,int CategoryType,int Position,int Deep,string Code)
		{
			this.Id = Id;
			this.Title = Title;
			this.ParentId = ParentId;
			this.IsActive = IsActive;
			this.IsRemove = IsRemove;
			this.CategoryType = CategoryType;
			this.Position = Position;
            this.Deep = Deep;
            this.Code = Code;
		}

		public override string ToString()
		{
			return "Id = " + Id.ToString() + ",Title = " + Title + ",ParentId = " + ParentId.ToString() + ",IsActive = " + IsActive.ToString() + ",IsRemove = " + IsRemove.ToString() + ",CategoryType = " + CategoryType.ToString() + ",Position = " + Position.ToString();
		}

		public class IdComparer : System.Collections.Generic.IComparer<Categories>
		{
			public SorterMode SorterMode;
			public IdComparer()
			{ }
			public IdComparer(SorterMode SorterMode)
			{
				this.SorterMode = SorterMode;
			}
			#region IComparer<Categories> Membres
			int System.Collections.Generic.IComparer<Categories>.Compare(Categories x, Categories y)
			{
				if (SorterMode == SorterMode.Ascending)
				{
					return y.Id.CompareTo(x.Id);
				}
				else
				{
					return x.Id.CompareTo(y.Id);
				}
			}
			#endregion
		}
		public class TitleComparer : System.Collections.Generic.IComparer<Categories>
		{
			public SorterMode SorterMode;
			public TitleComparer()
			{ }
			public TitleComparer(SorterMode SorterMode)
			{
				this.SorterMode = SorterMode;
			}
			#region IComparer<Categories> Membres
			int System.Collections.Generic.IComparer<Categories>.Compare(Categories x, Categories y)
			{
				if (SorterMode == SorterMode.Ascending)
				{
					return y.Title.CompareTo(x.Title);
				}
				else
				{
					return x.Title.CompareTo(y.Title);
				}
			}
			#endregion
		}
		public class ParentIdComparer : System.Collections.Generic.IComparer<Categories>
		{
			public SorterMode SorterMode;
			public ParentIdComparer()
			{ }
			public ParentIdComparer(SorterMode SorterMode)
			{
				this.SorterMode = SorterMode;
			}
			#region IComparer<Categories> Membres
			int System.Collections.Generic.IComparer<Categories>.Compare(Categories x, Categories y)
			{
				if (SorterMode == SorterMode.Ascending)
				{
					return y.ParentId.CompareTo(x.ParentId);
				}
				else
				{
					return x.ParentId.CompareTo(y.ParentId);
				}
			}
			#endregion
		}
		public class IsActiveComparer : System.Collections.Generic.IComparer<Categories>
		{
			public SorterMode SorterMode;
			public IsActiveComparer()
			{ }
			public IsActiveComparer(SorterMode SorterMode)
			{
				this.SorterMode = SorterMode;
			}
			#region IComparer<Categories> Membres
			int System.Collections.Generic.IComparer<Categories>.Compare(Categories x, Categories y)
			{
				if (SorterMode == SorterMode.Ascending)
				{
					return y.IsActive.CompareTo(x.IsActive);
				}
				else
				{
					return x.IsActive.CompareTo(y.IsActive);
				}
			}
			#endregion
		}
		public class IsRemoveComparer : System.Collections.Generic.IComparer<Categories>
		{
			public SorterMode SorterMode;
			public IsRemoveComparer()
			{ }
			public IsRemoveComparer(SorterMode SorterMode)
			{
				this.SorterMode = SorterMode;
			}
			#region IComparer<Categories> Membres
			int System.Collections.Generic.IComparer<Categories>.Compare(Categories x, Categories y)
			{
				if (SorterMode == SorterMode.Ascending)
				{
					return y.IsRemove.CompareTo(x.IsRemove);
				}
				else
				{
					return x.IsRemove.CompareTo(y.IsRemove);
				}
			}
			#endregion
		}
		public class CategoryTypeComparer : System.Collections.Generic.IComparer<Categories>
		{
			public SorterMode SorterMode;
			public CategoryTypeComparer()
			{ }
			public CategoryTypeComparer(SorterMode SorterMode)
			{
				this.SorterMode = SorterMode;
			}
			#region IComparer<Categories> Membres
			int System.Collections.Generic.IComparer<Categories>.Compare(Categories x, Categories y)
			{
				if (SorterMode == SorterMode.Ascending)
				{
					return y.CategoryType.CompareTo(x.CategoryType);
				}
				else
				{
					return x.CategoryType.CompareTo(y.CategoryType);
				}
			}
			#endregion
		}
		public class PositionComparer : System.Collections.Generic.IComparer<Categories>
		{
			public SorterMode SorterMode;
			public PositionComparer()
			{ }
			public PositionComparer(SorterMode SorterMode)
			{
				this.SorterMode = SorterMode;
			}
			#region IComparer<Categories> Membres
			int System.Collections.Generic.IComparer<Categories>.Compare(Categories x, Categories y)
			{
				if (SorterMode == SorterMode.Ascending)
				{
					return y.Position.CompareTo(x.Position);
				}
				else
				{
					return x.Position.CompareTo(y.Position);
				}
			}
			#endregion
		}
	}
}
